/*
 * @Description: 逻辑运算符
 * @Author: zzj
 * @Date: 2021-08-31 12:00:17
 * @LastEditors: zzj
 * @LastEditTime: 2021-08-31 12:29:45
 */

//与 或 非
var num1 = 1;
var num2 = -1;
var num3 = 0;
if(num1>0 && num2>0){   // &&  两边都为真，才为真
    console.log("yes")
}else{
    console.log("no")
}

if(num1>0 || num2>0){    // ||  只要有一边为真，就为真
    console.log("yes")
}else{
    console.log("no")
}

if(!num1>0){              // ！  取反
    console.log("yes")
}else{
    console.log("no")
}
//三目表达式
console.log(num1>0?"yes":"no");

var res = num1?"yes":"no";
console.log(res);

var res = num2?"yes":"no";
console.log(res);

var res = num3?"yes":"no";
console.log(res);
// 一个变量以下情况为假
/*''、0、null、undefind、false、 */
var res = {}?"yes":"no";  //为{}时，取真
console.log(res);

var a=1,s=2,d=3;
console.log(a,s,d)

//位运算
console.log(a & d);  //1
console.log(a | d);  //3
console.log(a ^ d);  //2